﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Dynamic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc;
using Webdiyer.WebControls.Mvc;
using Zor_Bll;
using Zor_Modes;
using Zor_Tools;
using Zor_Web.Models;
using Zor_Web.Models.Warning;
using Zor_Web.Models.Systems;

namespace Zor_Web.Controllers
{
    [Authorization]
    public class WarningController : Controller
    {
        //
        // GET: /Warning/

        #region - 租户到期预警 -
        /// <summary>
        /// 加载数据
        /// </summary>
        /// <param name="index">页码</param>
        /// <param name="where">条件</param>
        /// <returns></returns>
        public ActionResult TenantWarn(int? index = 1, string where = null)
        {
            int totalCount = 0;
            int pageIndex = index ?? 1;

            PagedList<V_TenantWarn> zvPager = TenantWarn_Bll<V_TenantWarn>.GetPageList(pageIndex, out totalCount, " Dt_Id = "+ RequestSession.GetSessionUser().DT_Id +"").AsQueryable().ToPagedList(0, 10) as PagedList<V_TenantWarn>;

            zvPager.TotalItemCount = totalCount;
            zvPager.CurrentPageIndex = (int)(index ?? 1);

            V_TenantWarn vh = new V_TenantWarn();
            vh.PageData = zvPager;
            return View(vh);
        }

        /// <summary>
        /// 导出租户到期预警信息列表
        /// create 刘云飞 by 2017/04/06
        /// </summary>
        /// <param name="TenantWarnMeg">要导出的列表字段集合</param>
        /// <returns>返回数据流</returns>
        [HttpPost]
        public FileResult ExportTenantWarn(FormCollection form)
        {
            string TenantWarnMeg = form["TenantWarnMeg"];
            string where = form["where"];
            string[] str_arr = TenantWarnMeg.Split(',');
            NoSortHashTable nameList = new NoSortHashTable();

            for (int i = 0; i < str_arr.Length; i++)
            {
                if (str_arr[i] != "")
                {
                    string[] item = str_arr[i].Split('|');
                    nameList.Add(item[0], item[1]);
                }
            }

            #region 拼接table

            System.Text.StringBuilder data = new System.Text.StringBuilder();
            if (nameList != null)
            {
                data.Append("<table cellspacing=\"0\" cellpadding=\"5\" rules=\"all\">");
                //写出列名
                data.Append("<tr style=\"font-weight: bold; white-space: nowrap;\">");


                foreach (string s in nameList.Keys)
                {
                    data.Append("<td>" + nameList[s] + "</td>");
                }
                data.Append("</tr>");

                List<V_TenantWarn> list = TenantWarn_Bll<V_TenantWarn>.GetList(where);
                //写出数据
                foreach (V_TenantWarn model in list)
                {
                    data.Append("<tr>");
                    foreach (string sm in nameList.Keys)
                    {
                        switch (sm)
                        {
                            
                            case "Bd_Name": data.Append("<td>" + model.Bd_Name + "</td>"); ; break;
                            case "Uim_Name": data.Append("<td>" + model.Uim_Name + "</td>"); ; break;
                            case "Hs_Number": data.Append("<td style='vnd.ms-excel.numberformat:@'>" + model.Hs_Number.ToString() + "</td>"); ; break;
                            case "Hs_Proportion": data.Append("<td>" + model.Hs_Proportion.ToString() + "</td>"); ; break;
                            case "NatPer_Name": data.Append("<td>" + model.NatPer_Name + "</td>"); ; break;
                            case "NatPer_Phone": data.Append("<td>" + model.NatPer_Phone + "</td>"); ; break;
                            case "TenantType": data.Append("<td>" + model.TenantType + "</td>"); ; break;
                            case "Tenant_Name": data.Append("<td style='vnd.ms-excel.numberformat:@'>" + model.Tenant_Name + "</td>"); ; break;
                            case "LeaseRent": data.Append("<td>" + model.LeaseRent.ToString() + "</td>"); ; break;
                            case "Lease_StartTime": data.Append("<td>" + TimeHelper.TimeStampToDateTime(model.Lease_StartTime.ToString(), TimeHelper.ToTimeType.link_ymd) + "</td>"); ; break;
                            case "Lease_EndTime": data.Append("<td>" + TimeHelper.TimeStampToDateTime(model.Lease_EndTime.ToString(), TimeHelper.ToTimeType.link_ymd) + "</td>"); ; break;
                            case "DueDate": data.Append("<td>" + model.DueDate + "</td>"); ; break;
                        }
                    }
                    data.Append("</tr>");
                }
                data.Append("</table>");
            }
            #endregion

            string sw = ExcelHelper.ExcelTemplate(data.ToString());

            string fileName = DateTime.Now.ToString("yyyyMMddHHmmss");
            // 写入到数据流
            return File(System.Text.Encoding.UTF8.GetBytes(sw.ToString()), "application/octet-stream", "租户到期预警清单_" + fileName + ".xls");

        }

        #endregion

        #region - 收费预警 -
        /// <summary>
        /// 加载数据
        /// </summary>
        /// <param name="index">页码</param>
        /// <param name="where">条件</param>
        /// <returns></returns>
        public ActionResult PrayWarn(int? index = 1, string where = null)
        {
            int totalCount = 0;
            int pageIndex = index ?? 1;

            PagedList<V_PrayWarn> zvPager = PrayWarn_Bll<V_PrayWarn>.GetPageList(pageIndex, out totalCount, " Dt_Id = " + RequestSession.GetSessionUser().DT_Id + "").AsQueryable().ToPagedList(0, 10) as PagedList<V_PrayWarn>;

            zvPager.TotalItemCount = totalCount;
            zvPager.CurrentPageIndex = (int)(index ?? 1);

            V_PrayWarn vh = new V_PrayWarn();
            vh.PageData = zvPager;
            return View(vh);
        }

        /// <summary>
        /// 导出税收信息列表
        /// create 刘云飞 by 2017/04/06
        /// </summary>
        /// <param name="PrayWarnMeg">要导出的列表字段集合</param>
        /// <returns>返回数据流</returns>
        [HttpPost]
        public FileResult ExportPrayWarn(FormCollection form)
        {
            string PrayWarnMeg = form["PrayWarnMeg"];
            string where = form["where"];
            string[] str_arr = PrayWarnMeg.Split(',');
            NoSortHashTable nameList = new NoSortHashTable();

            for (int i = 0; i < str_arr.Length; i++)
            {
                if (str_arr[i] != "")
                {
                    string[] item = str_arr[i].Split('|');
                    nameList.Add(item[0], item[1]);
                }
            }

            #region 拼接table

            System.Text.StringBuilder data = new System.Text.StringBuilder();
            if (nameList != null)
            {
                data.Append("<table cellspacing=\"0\" cellpadding=\"5\" rules=\"all\">");
                //写出列名
                data.Append("<tr style=\"font-weight: bold; white-space: nowrap;\">");


                foreach (string s in nameList.Keys)
                {
                    data.Append("<td>" + nameList[s] + "</td>");
                }
                data.Append("</tr>");

                List<V_PrayWarn> list = PrayWarn_Bll<V_PrayWarn>.GetList(where);
                //写出数据
                foreach (V_PrayWarn model in list)
                {
                    data.Append("<tr>");
                    foreach (string sm in nameList.Keys)
                    {
                        switch (sm)
                        {

                            case "Bd_Name": data.Append("<td>" + model.Bd_Name + "</td>"); ; break;
                            case "Uim_Name": data.Append("<td>" + model.Uim_Name + "</td>"); ; break;
                            case "Hs_Number": data.Append("<td style='vnd.ms-excel.numberformat:@'>" + model.Hs_Number.ToString() + "</td>"); ; break;
                            case "Hs_Proportion": data.Append("<td>" + model.Hs_Proportion.ToString() + "</td>"); ; break;
                            case "NatPer_Name": data.Append("<td>" + model.NatPer_Name + "</td>"); ; break;
                            case "NatPer_Phone": data.Append("<td>" + model.NatPer_Phone + "</td>"); ; break;
                            case "TenantType": data.Append("<td>" + model.TenantType + "</td>"); ; break;
                            case "Tenant_Name": data.Append("<td style='vnd.ms-excel.numberformat:@'>" + model.Tenant_Name + "</td>"); ; break;
                            case "EvaluateRent": data.Append("<td>" + model.EvaluateRent.ToString() + "</td>"); ; break;
                            case "Lease_StartTime": data.Append("<td>" + TimeHelper.TimeStampToDateTime(model.Lease_StartTime.ToString(), TimeHelper.ToTimeType.link_ymd) + "</td>"); ; break;
                            case "Lease_EndTime": data.Append("<td>" + TimeHelper.TimeStampToDateTime(model.Lease_EndTime.ToString(), TimeHelper.ToTimeType.link_ymd) + "</td>"); ; break;
                            case "Acceptance_TaxEndTime": data.Append("<td>" + TimeHelper.TimeStampToDateTime(model.Acceptance_TaxEndTime.ToString(), TimeHelper.ToTimeType.link_ymd) + "</td>"); ; break;
                            
                        }
                    }
                    data.Append("</tr>");
                }
                data.Append("</table>");
            }
            #endregion

            string sw = ExcelHelper.ExcelTemplate(data.ToString());

            string fileName = DateTime.Now.ToString("yyyyMMddHHmmss");
            // 写入到数据流
            return File(System.Text.Encoding.UTF8.GetBytes(sw.ToString()), "application/octet-stream", "税收预警清单_" + fileName + ".xls");

        }

        #endregion

        #region - 房屋出租查询 -
        /// <summary>
        /// 加载数据
        /// </summary>
        /// <param name="index">页码</param>
        /// <param name="where">条件</param>
        /// <returns></returns>
        public ActionResult HouseRental(V_HouseRental Model,int? index = 1, string where = null)
        {
            int totalCount = 0;
            int pageIndex = index ?? 1;

            PagedList<V_HouseRental> zvPager = HouseRental_Bll<V_HouseRental>.GetPageList(Model,pageIndex, out totalCount, where).AsQueryable().ToPagedList(0, 10) as PagedList<V_HouseRental>;

            zvPager.TotalItemCount = totalCount;
            zvPager.CurrentPageIndex = (int)(index ?? 1);

            V_HouseRental vh = new V_HouseRental();
            vh.PageData = zvPager;
            TempData["QueryConditions"] = Model;//给导出数据传查询条件
            return View(vh);
        }

        /// <summary>
        /// 导出税收信息列表
        /// create 刘云飞 by 2017/04/06
        /// </summary>
        /// <param name="HouseRentalMeg">要导出的列表字段集合</param>
        /// <returns>返回数据流</returns>
        [HttpPost]
        public FileResult ExportHouseRental(FormCollection form)
        {
            string HouseRentalMeg = form["HouseRentalMeg"];
            string where = form["where"];
            string[] str_arr = HouseRentalMeg.Split(',');
            NoSortHashTable nameList = new NoSortHashTable();

            for (int i = 0; i < str_arr.Length; i++)
            {
                if (str_arr[i] != "")
                {
                    string[] item = str_arr[i].Split('|');
                    nameList.Add(item[0], item[1]);
                }
            }

            #region 拼接table

            System.Text.StringBuilder data = new System.Text.StringBuilder();
            if (nameList != null)
            {
                data.Append("<table cellspacing=\"0\" cellpadding=\"5\" rules=\"all\">");
                //写出列名
                data.Append("<tr style=\"font-weight: bold; white-space: nowrap;\">");


                foreach (string s in nameList.Keys)
                {
                    data.Append("<td>" + nameList[s] + "</td>");
                }
                data.Append("</tr>");

                List<V_HouseRental> list = HouseRental_Bll<V_HouseRental>.GetList((V_HouseRental)TempData["QueryConditions"], where);
                //写出数据
                foreach (V_HouseRental model in list)
                {
                    data.Append("<tr>");
                    foreach (string sm in nameList.Keys)
                    {
                        switch (sm)
                        {

                            case "Bd_Name": data.Append("<td>" + model.Bd_Name + "</td>"); ; break;
                            case "Uim_Name": data.Append("<td>" + model.Uim_Name + "</td>"); ; break;
                            case "Hs_Number": data.Append("<td style='vnd.ms-excel.numberformat:@'>" + model.Hs_Number.ToString() + "</td>"); ; break;
                            case "Hs_Proportion": data.Append("<td>" + model.Hs_Proportion.ToString() + "</td>"); ; break;
                            case "NatPer_Name": data.Append("<td>" + model.NatPer_Name + "</td>"); ; break;
                            case "NatPer_Phone": data.Append("<td>" + model.NatPer_Phone + "</td>"); ; break;
                            case "TenantType": data.Append("<td>" + model.TenantType + "</td>"); ; break;
                            case "Tenant_Name": data.Append("<td style='vnd.ms-excel.numberformat:@'>" + model.Tenant_Name + "</td>"); ; break;
                            case "LeaseRent": data.Append("<td>" + model.LeaseRent.ToString() + "</td>"); ; break;
                            case "Lease_StartTime": data.Append("<td>" + TimeHelper.TimeStampToDateTime(model.Lease_StartTime.ToString(), TimeHelper.ToTimeType.link_ymd) + "</td>"); ; break;
                            case "Lease_EndTime": data.Append("<td>" + TimeHelper.TimeStampToDateTime(model.Lease_EndTime.ToString(), TimeHelper.ToTimeType.link_ymd) + "</td>"); ; break;
                            
                        }
                    }
                    data.Append("</tr>");
                }
                data.Append("</table>");
            }
            #endregion

            string sw = ExcelHelper.ExcelTemplate(data.ToString());

            string fileName = DateTime.Now.ToString("yyyyMMddHHmmss");
            // 写入到数据流
            return File(System.Text.Encoding.UTF8.GetBytes(sw.ToString()), "application/octet-stream", "房屋出租清单_" + fileName + ".xls");

        }

        #endregion

        #region - 税收明细查询 -
        /// <summary>
        /// 加载数据
        /// </summary>
        /// <param name="index">页码</param>
        /// <param name="where">条件</param>
        /// <returns></returns>
        public ActionResult SearchPay(V_SearchPay model, int? index = 1, string where = null)
        {
            int totalCount = 0;
            int pageIndex = index ?? 1;

            PagedList<V_SearchPay> zvPager = SearchPay_Bll<V_SearchPay>.GetPageList(model, pageIndex, out totalCount, where).AsQueryable().ToPagedList(0, 10) as PagedList<V_SearchPay>;

            zvPager.TotalItemCount = totalCount;
            zvPager.CurrentPageIndex = (int)(index ?? 1);

            V_SearchPay vh = new V_SearchPay();
            vh.PageData = zvPager;
            TempData["QueryConditions"] = model;//给导出数据传查询条件
            return View(vh);
        }

        /// <summary>
        /// 导出税收信息列表
        /// create 刘云飞 by 2017/04/06
        /// </summary>
        /// <param name="SearchPayMeg">要导出的列表字段集合</param>
        /// <returns>返回数据流</returns>
        [HttpPost]
        public FileResult ExportSearchPay(FormCollection form)
        {
            string SearchPayMeg = form["SearchPayMeg"];
            string where = form["where"];
            string[] str_arr = SearchPayMeg.Split(',');
            NoSortHashTable nameList = new NoSortHashTable();

            for (int i = 0; i < str_arr.Length; i++)
            {
                if (str_arr[i] != "")
                {
                    string[] item = str_arr[i].Split('|');
                    nameList.Add(item[0], item[1]);
                }
            }

            #region 拼接table

            System.Text.StringBuilder data = new System.Text.StringBuilder();
            if (nameList != null)
            {
                data.Append("<table cellspacing=\"0\" cellpadding=\"5\" rules=\"all\">");
                //写出列名
                data.Append("<tr style=\"font-weight: bold; white-space: nowrap;\">");


                foreach (string s in nameList.Keys)
                {
                    data.Append("<td>" + nameList[s] + "</td>");
                }
                data.Append("</tr>");

                List<V_SearchPay> list = SearchPay_Bll<V_SearchPay>.GetList((V_SearchPay)TempData["QueryConditions"], where);
                //写出数据
                foreach (V_SearchPay model in list)
                {
                    data.Append("<tr>");
                    foreach (string sm in nameList.Keys)
                    {
                        switch (sm)
                        {

                            case "Bd_Name": data.Append("<td>" + model.Bd_Name + "</td>"); ; break;
                            case "Uim_Name": data.Append("<td>" + model.Uim_Name + "</td>"); ; break;
                            case "Hs_Number": data.Append("<td style='vnd.ms-excel.numberformat:@'>" + model.Hs_Number.ToString() + "</td>"); ; break;
                            
                            case "NatPer_Name": data.Append("<td>" + model.NatPer_Name + "</td>"); ; break;
                            case "NatPer_IDNumber": data.Append("<td style='vnd.ms-excel.numberformat:@'>" + model.NatPer_IDNumber + "</td>"); ; break;
                            case "NatPer_Phone": data.Append("<td>" + model.NatPer_Phone + "</td>"); ; break;
                            case "NatSex": data.Append("<td>" + model.NatSex + "</td>"); ; break;
                            case "PtActualTax": data.Append("<td style='vnd.ms-excel.numberformat:@'>" + model.PtActualTax.ToString() + "</td>"); ; break;
                            case "Acceptance_TaxStartTime": data.Append("<td>" + TimeHelper.TimeStampToDateTime(model.Acceptance_TaxStartTime.ToString(), TimeHelper.ToTimeType.link_ymd) + "</td>"); ; break;
                            case "Acceptance_TaxEndTime": data.Append("<td>" + TimeHelper.TimeStampToDateTime(model.Acceptance_TaxEndTime.ToString(), TimeHelper.ToTimeType.link_ymd) + "</td>"); ; break;
                            case "Pt_Date": data.Append("<td>" + TimeHelper.TimeStampToDateTime(model.Pt_Date.ToString(), TimeHelper.ToTimeType.link_ymd) + "</td>"); ; break;
                            case "LeaseRent": data.Append("<td>" + model.LeaseRent.ToString() + "</td>"); ; break;
                            case "Nature": data.Append("<td>" + model.Nature + "</td>"); ; break;
                            case "Hs_Proportion": data.Append("<td>" + model.Hs_Proportion.ToString() + "</td>"); ; break;
                        }
                    }
                    data.Append("</tr>");
                }
                data.Append("</table>");
            }
            #endregion

            string sw = ExcelHelper.ExcelTemplate(data.ToString());

            string fileName = DateTime.Now.ToString("yyyyMMddHHmmss");
            // 写入到数据流
            return File(System.Text.Encoding.UTF8.GetBytes(sw.ToString()), "application/octet-stream", "税收明细查询清单_" + fileName + ".xls");

        }

        #endregion

        #region - 税收管理 -
        /// <summary>
        /// 加载数据
        /// </summary>
        /// <param name="index">页码</param>
        /// <param name="where">条件</param>
        /// <returns></returns>
        public ActionResult PrayAcceptance(V_PrayAcceptance Model, int? index = 1, string where = null)
        {
            int totalCount = 0;
            int pageIndex = index ?? 1;

            PagedList<V_PrayAcceptance> zvPager = PrayAcceptance_Bll<V_PrayAcceptance>.GetPageList(Model, pageIndex, out totalCount, where).AsQueryable().ToPagedList(0, 10) as PagedList<V_PrayAcceptance>;

            zvPager.TotalItemCount = totalCount;
            zvPager.CurrentPageIndex = (int)(index ?? 1);

            V_PrayAcceptance vh = new V_PrayAcceptance();
            vh.PageData = zvPager;
            TempData["QueryConditions"] = Model;//给导出数据传查询条件
            return View(vh);
        }

        /// <summary>
        /// 导出税收信息列表
        /// create 刘云飞 by 2017/04/06
        /// </summary>
        /// <param name="PrayAcceptanceMeg">要导出的列表字段集合</param>
        /// <returns>返回数据流</returns>
        [HttpPost]
        public FileResult ExportPrayAcceptance(FormCollection form)
        {
            string PrayAcceptancePayMeg = form["PrayAcceptancePayMeg"];
            string where = form["where"];
            string[] str_arr = PrayAcceptancePayMeg.Split(',');
            NoSortHashTable nameList = new NoSortHashTable();

            for (int i = 0; i < str_arr.Length; i++)
            {
                if (str_arr[i] != "")
                {
                    string[] item = str_arr[i].Split('|');
                    nameList.Add(item[0], item[1]);
                }
            }

            #region 拼接table

            System.Text.StringBuilder data = new System.Text.StringBuilder();
            if (nameList != null)
            {
                data.Append("<table cellspacing=\"0\" cellpadding=\"5\" rules=\"all\">");
                //写出列名
                data.Append("<tr style=\"font-weight: bold; white-space: nowrap;\">");


                foreach (string s in nameList.Keys)
                {
                    data.Append("<td>" + nameList[s] + "</td>");
                }
                data.Append("</tr>");

                List<V_PrayAcceptance> list = PrayAcceptance_Bll<V_PrayAcceptance>.GetList((V_PrayAcceptance)TempData["QueryConditions"], where);
                //写出数据
                foreach (V_PrayAcceptance Model in list)
                {
                    data.Append("<tr>");
                    foreach (string sm in nameList.Keys)
                    {
                        switch (sm)
                        {
                            case "Acceptance_TicketNumber": data.Append("<td  style='vnd.ms-excel.numberformat:@'>" + Model.Acceptance_TicketNumber + "</td>"); ; break;
                            case "NatPer_Name": data.Append("<td>" + Model.NatPer_Name + "</td>"); ; break;
                            case "NatPer_IDNumber": data.Append("<td style='vnd.ms-excel.numberformat:@'>" + Model.NatPer_IDNumber + "</td>"); ; break;
                            case "NatPer_Phone": data.Append("<td>" + Model.NatPer_Phone + "</td>"); ; break;
                            case "Acceptance_TaxNumber": data.Append("<td style='vnd.ms-excel.numberformat:@'>" + Model.Acceptance_TaxNumber + "</td>"); ; break;
                            case "Tenant_Name": data.Append("<td>" + Model.Tenant_Name + "</td>"); ; break;
                            case "Csqx": data.Append("<td>" + Model.Csqx + "</td>"); ; break;
                            case "AHA": data.Append("<td style='vnd.ms-excel.numberformat:@'>" + Model.AHA + "</td>"); ; break;
                            case "Hs_Proportion": data.Append("<td style='vnd.ms-excel.numberformat:@'>" + Model.Hs_Proportion.ToString() + "</td>"); ; break;
                            case "EReviewRent": data.Append("<td style='vnd.ms-excel.numberformat:@'>" + Model.EReviewRent + "</td>"); ; break;                            
                            case "Acceptance_PropertyTax": data.Append("<td style='vnd.ms-excel.numberformat:@'>" + Model.Acceptance_PropertyTax.ToString() + "</td>"); ; break;
                            case "Acceptance_PersonalTax": data.Append("<td>" + Model.Acceptance_PersonalTax.ToString() + "</td>"); ; break;
                            case "PtActualTax": data.Append("<td>" + Model.PtActualTax.ToString() + "</td>"); ; break;
                            case "Pt_Date": data.Append("<td>" + TimeHelper.TimeStampToDateTime(Model.Pt_Date.ToString(), TimeHelper.ToTimeType.link_ymd) + "</td>"); ; break;
                            case "AcceptanceType": data.Append("<td>" + Model.AcceptanceType + "</td>"); ; break;
                            case "Acceptance_Address": data.Append("<td>" + Model.Acceptance_Address+ "</td>"); ; break;
                            case "Acceptance_TaxStartTime": data.Append("<td>" + TimeHelper.TimeStampToDateTime(Model.Acceptance_TaxStartTime.ToString(), TimeHelper.ToTimeType.link_ymd) + "</td>"); ; break;
                            case "Acceptance_TaxEndTime": data.Append("<td>" + TimeHelper.TimeStampToDateTime(Model.Acceptance_TaxEndTime.ToString(), TimeHelper.ToTimeType.link_ymd) + "</td>"); ; break;
                            case "Lease_StartTime": data.Append("<td>" + TimeHelper.TimeStampToDateTime(Model.Lease_StartTime.ToString(), TimeHelper.ToTimeType.link_ymd) + "</td>"); ; break;
                            case "Lease_EndTime": data.Append("<td>" + TimeHelper.TimeStampToDateTime(Model.Lease_EndTime.ToString(), TimeHelper.ToTimeType.link_ymd) + "</td>"); ; break;                          
                            
                        }
                    }
                    data.Append("</tr>");
                }
                data.Append("</table>");
            }
            #endregion

            string sw = ExcelHelper.ExcelTemplate(data.ToString());

            string fileName = DateTime.Now.ToString("yyyyMMddHHmmss");
            // 写入到数据流
            return File(System.Text.Encoding.UTF8.GetBytes(sw.ToString()), "application/octet-stream", "税收管理清单_" + fileName + ".xls");

        }

        #endregion

        #region - GIS地图预览 -
        public ActionResult GIS_Preview()
        {
            return View();
        }

        /// <summary>
        /// 获取社区经纬度信息
        /// </summary>
        /// <returns></returns>
        public ActionResult CommunityLongitudeAndLatitude()
        {

            List<dynamic> lst = CommunityPreview_Bll<dynamic>.GetCommunityLonAndLat();
            string lon =lst[0].Dt_BD_Longitude; //经度           
            string lonStat = lon.Substring(0, 3);
            string lonEnd =  lon.Substring(3, 5);
            string CommunityLon = "" + lonStat + "." + lonEnd + "";

            string lat = lst[0].Dt_BD_Latitude;  //纬度
            string latStat = lat.Substring(0, 2);
            string latEnd = lat.Substring(2, 5);
            string CommunityLat = "" + latStat + "." + latEnd + "";
            string CommunityLonAndLat = "" + CommunityLon + "," + CommunityLat + "";  //拼接经纬度

            return Content(CommunityLonAndLat);
        }

        /// <summary>
        /// 获取社区名称
        /// </summary>
        /// <returns></returns>
        public ActionResult CommunityName()
        {
            List<dynamic> lst = CommunityPreview_Bll<dynamic>.GetCommunityLonAndLat();
            string CommunityName = lst[0].Dt_Name; //社区 
            string Str = lst[0].SOName; //街道办
            return Content("" + Str + "" + CommunityName + "");
        }
        /// <summary>
        /// 获取街道办地图加载信息
        /// </summary>
        /// <returns></returns>
        public ActionResult GetMapList()
        {

            //获取所有街道办名称、
            List<dynamic> lst = AnnualTaskMap_Bll<dynamic>.GetMap();
            return Content(lst.ToJson());
        }

        /// <summary>
        /// 获取街道办地图加载信息
        /// </summary>
        /// <returns></returns>
        public ActionResult GetMap()
        {
            List<V_CommunityPreview> lst_sq = CommunityPreview_Bll<V_CommunityPreview>.GetSQ();
            return Content(lst_sq.ToJson());
        }

        /// <summary>
        /// 获取楼宇下拉菜单
        /// </summary>
        /// <returns></returns>
        public ActionResult ListAddress()
        {
            string stdata;
            List<dynamic> lstBuilding = CommunityPreview_Bll<dynamic>.GetListAddress();
            List<dynamic> listSq = CommunityPreview_Bll<dynamic>.GetListSq();
            if (lstBuilding.Count == 0)
            {
                stdata = "";
            }
            else
            {
                stdata = lstBuilding[0].Dt_Name + listSq[0].Dt_Name;
            }
            return Content(stdata);
        }
        #endregion
    }
}
